home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1365 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What the hell is THIS?!
  5. Date: 13 Jan 1996 00:33:18 -0500
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4d7g6u$j0l@umbc9.umbc.edu>
  8. References: <4d6rgh$rfu@abel.cc.sunysb.edu>
  9. NNTP-Posting-Host: f-umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. Bommasamudram Madhusudan <bmadhusu@engws12.ic.sunysb.edu> wrote:
  13. |> hi guys;
  14. |> 
  15. |> I'm going nuts trying to figure this out;
  16. |> 
  17. |> Can someone explain what
  18. |> 
  19. |>   int (*p)[3]  is?????
  20. |> 
  21. |>   Is this an array of pointers to integers 
  22. |> 
  23. |>   OR
  24. |> 
  25. |>   a pointer to an array of integers?? HELP!
  26.  
  27. According to cdecl:
  28.  
  29. cdecl> explain int (*p)[3]
  30. declare p as pointer to array 3 of int
  31.  
  32. |> I can say things like:
  33. |> 
  34. |> (*p)[0] = 3; for e.g, but when I print the value using:
  35. |> 
  36. |>  printf("%d",(*p)[0]) I get a core dump!
  37.  
  38. Exactly...Because it is a pointer, you need to associate some space
  39. with it via malloc() or the like.
  40. -- 
  41. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  42.  
  43. Jonas J. Schlein  (schlein@gl.umbc.edu)
  44.